Skip to content

Conversation

laevandus
Copy link
Contributor

🔗 Issue Links

Related: IOS-1003

🎯 Goal

StreamCollection and LazyCachedMapCollection do not add any value anymore

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Documentation has been updated in the docs-content repo

@laevandus laevandus requested a review from a team as a code owner October 3, 2025 06:57
@laevandus laevandus added the 💥 Breaking Changes A PR that contains breaking changes label Oct 3, 2025
@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Oct 3, 2025

SDK Size

title develop branch diff status
StreamChatSwiftUI 9.57 MB 9.98 MB +420 KB 🟡

Copy link

github-actions bot commented Oct 3, 2025

1 Message
📖 There seems to be app changes but CHANGELOG wasn't modified.
Please include an entry if the PR includes user-facing changes.
You can find it at CHANGELOG.md.

Generated by 🚫 Danger

Copy link

github-actions bot commented Oct 3, 2025

Public Interface

 public struct ThreadList: View  
-   public init(factory: Factory,threads: LazyCachedMapCollection<ChatThread>,threadDestination: @escaping @MainActor (ChatThread) -> Factory.ThreadDestination,selectedThread: Binding<ThreadSelectionInfo?>,onItemTap: @escaping (ChatThread) -> Void,onItemAppear: @escaping (Int) -> Void,headerView: @escaping () -> HeaderView,footerView: @escaping () -> FooterView)
+   public init(factory: Factory,threads: [ChatThread],threadDestination: @escaping @MainActor (ChatThread) -> Factory.ThreadDestination,selectedThread: Binding<ThreadSelectionInfo?>,onItemTap: @escaping (ChatThread) -> Void,onItemAppear: @escaping (Int) -> Void,headerView: @escaping () -> HeaderView,footerView: @escaping () -> FooterView)

 public struct ChannelsLazyVStack: View  
-   public init(factory: Factory,channels: LazyCachedMapCollection<ChatChannel>,selectedChannel: Binding<ChannelSelectionInfo?>,swipedChannelId: Binding<String?>,onlineIndicatorShown: @escaping @MainActor (ChatChannel) -> Bool,imageLoader: @escaping @MainActor (ChatChannel) -> UIImage,onItemTap: @escaping @MainActor (ChatChannel) -> Void,onItemAppear: @escaping @MainActor (Int) -> Void,channelNaming: @escaping @MainActor (ChatChannel) -> String,channelDestination: @escaping @MainActor (ChannelSelectionInfo) -> Factory.ChannelDestination,trailingSwipeRightButtonTapped: @escaping @MainActor (ChatChannel) -> Void,trailingSwipeLeftButtonTapped: @escaping @MainActor (ChatChannel) -> Void,leadingSwipeButtonTapped: @escaping @MainActor (ChatChannel) -> Void)
+   public init(factory: Factory,channels: [ChatChannel],selectedChannel: Binding<ChannelSelectionInfo?>,swipedChannelId: Binding<String?>,onlineIndicatorShown: @escaping @MainActor (ChatChannel) -> Bool,imageLoader: @escaping @MainActor (ChatChannel) -> UIImage,onItemTap: @escaping @MainActor (ChatChannel) -> Void,onItemAppear: @escaping @MainActor (Int) -> Void,channelNaming: @escaping @MainActor (ChatChannel) -> String,channelDestination: @escaping @MainActor (ChannelSelectionInfo) -> Factory.ChannelDestination,trailingSwipeRightButtonTapped: @escaping @MainActor (ChatChannel) -> Void,trailingSwipeLeftButtonTapped: @escaping @MainActor (ChatChannel) -> Void,leadingSwipeButtonTapped: @escaping @MainActor (ChatChannel) -> Void)

 public struct MessageListView: View, KeyboardReadable  
-   public init(factory: Factory,channel: ChatChannel,messages: LazyCachedMapCollection<ChatMessage>,messagesGroupingInfo: [String: [String]],scrolledId: Binding<String?>,showScrollToLatestButton: Binding<Bool>,quotedMessage: Binding<ChatMessage?>,currentDateString: String? = nil,listId: String,isMessageThread: Bool = false,shouldShowTypingIndicator: Bool = false,scrollPosition: Binding<String?> = .constant(nil),loadingNextMessages: Bool = false,firstUnreadMessageId: Binding<MessageId?> = .constant(nil),onMessageAppear: @escaping @MainActor (Int, ScrollDirection) -> Void,onScrollToBottom: @escaping @MainActor () -> Void,onLongPress: @escaping @MainActor (MessageDisplayInfo) -> Void,onJumpToMessage: ((String) -> Bool)? = nil)
+   public init(factory: Factory,channel: ChatChannel,messages: [ChatMessage],messagesGroupingInfo: [String: [String]],scrolledId: Binding<String?>,showScrollToLatestButton: Binding<Bool>,quotedMessage: Binding<ChatMessage?>,currentDateString: String? = nil,listId: String,isMessageThread: Bool = false,shouldShowTypingIndicator: Bool = false,scrollPosition: Binding<String?> = .constant(nil),loadingNextMessages: Bool = false,firstUnreadMessageId: Binding<MessageId?> = .constant(nil),onMessageAppear: @escaping @MainActor (Int, ScrollDirection) -> Void,onScrollToBottom: @escaping @MainActor () -> Void,onLongPress: @escaping @MainActor (MessageDisplayInfo) -> Void,onJumpToMessage: ((String) -> Bool)? = nil)

 public struct ChannelList: View  
-   public init(factory: Factory,channels: LazyCachedMapCollection<ChatChannel>,selectedChannel: Binding<ChannelSelectionInfo?>,swipedChannelId: Binding<String?>,scrolledChannelId: Binding<String?> = .constant(nil),scrollable: Bool = true,onlineIndicatorShown: (@MainActor (ChatChannel) -> Bool)? = nil,imageLoader: (@MainActor (ChatChannel) -> UIImage)? = nil,onItemTap: @escaping @MainActor (ChatChannel) -> Void,onItemAppear: @escaping @MainActor (Int) -> Void,channelNaming: (@MainActor (ChatChannel) -> String)? = nil,channelDestination: @escaping @MainActor (ChannelSelectionInfo) -> Factory.ChannelDestination,trailingSwipeRightButtonTapped: @escaping @MainActor (ChatChannel) -> Void = { _ in },trailingSwipeLeftButtonTapped: @escaping @MainActor (ChatChannel) -> Void = { _ in },leadingSwipeButtonTapped: @escaping @MainActor (ChatChannel) -> Void = { _ in })
+   public init(factory: Factory,channels: [ChatChannel],selectedChannel: Binding<ChannelSelectionInfo?>,swipedChannelId: Binding<String?>,scrolledChannelId: Binding<String?> = .constant(nil),scrollable: Bool = true,onlineIndicatorShown: (@MainActor (ChatChannel) -> Bool)? = nil,imageLoader: (@MainActor (ChatChannel) -> UIImage)? = nil,onItemTap: @escaping @MainActor (ChatChannel) -> Void,onItemAppear: @escaping @MainActor (Int) -> Void,channelNaming: (@MainActor (ChatChannel) -> String)? = nil,channelDestination: @escaping @MainActor (ChannelSelectionInfo) -> Factory.ChannelDestination,trailingSwipeRightButtonTapped: @escaping @MainActor (ChatChannel) -> Void = { _ in },trailingSwipeLeftButtonTapped: @escaping @MainActor (ChatChannel) -> Void = { _ in },leadingSwipeButtonTapped: @escaping @MainActor (ChatChannel) -> Void = { _ in })

 public struct ThreadsLazyVStack: View  
-   public init(factory: Factory,threads: LazyCachedMapCollection<ChatThread>,threadDestination: @escaping @MainActor (ChatThread) -> Factory.ThreadDestination,selectedThread: Binding<ThreadSelectionInfo?>,onItemTap: @escaping (ChatThread) -> Void,onItemAppear: @escaping (Int) -> Void)
+   public init(factory: Factory,threads: [ChatThread],threadDestination: @escaping @MainActor (ChatThread) -> Factory.ThreadDestination,selectedThread: Binding<ThreadSelectionInfo?>,onItemTap: @escaping (ChatThread) -> Void,onItemAppear: @escaping (Int) -> Void)

@laevandus laevandus force-pushed the v5-remove-stream-collection-lazy-cached-map-collection branch 3 times, most recently from 5e741e6 to f7ab132 Compare October 7, 2025 13:06
var messages: LazyCachedMapCollection<ChatMessage> {
controller.messages
var messages: [ChatMessage] {
Array(controller.messages)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why's an array needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thank you

var messages: LazyCachedMapCollection<ChatMessage> {
var replies = messageController.replies
var messages: [ChatMessage] {
var replies = Array(messageController.replies)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thank you

primaryButton: .destructive(Text("Sign out")) {
withAnimation {
Task { await chatClient.disconnect() }
chatClient.disconnect {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen this being changed between these 2 methods. Any specific reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a mistake what happened when linter stuff was off (one of the rules changed it and caused an build error). Switching it back to closure based function like it used to be.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
78.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@laevandus laevandus merged commit d406d7a into v5 Oct 10, 2025
10 of 11 checks passed
@laevandus laevandus deleted the v5-remove-stream-collection-lazy-cached-map-collection branch October 10, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💥 Breaking Changes A PR that contains breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants